package com.cskaoyan.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;

/**
 * @author stone
 * @date 2022/04/29 17:49
 */
@RestController
@RequestMapping("upload")
public class UploadController {

    @RequestMapping("file")
    public String uploadFile(MultipartFile myfile) throws IOException {
        //transferTo → 参数 MultipartFile转换为一个什么样的file
        myfile.transferTo(new File("D:\\tmp","dlrb.jpg"));
        return "ok";
    }
}
